home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / plplot26 / part04 < prev    next >
Encoding:
Internet Message Format  |  1990-01-14  |  57.1 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i005: plplot 2.6 - C library for making scientific plots, Part04/12
  5. Message-ID: <10977@xanth.cs.odu.edu>
  6. Date: 14 Jan 90 23:13:59 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  9. Lines: 1876
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11.  
  12. Submitted-by: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  13. Posting-number: Volume 90, Issue 005
  14. Archive-name: applications/plplot-2.6/part04
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 4 (of 12)."
  23. # Contents:  Amiga/plwindow.c docs/chapter1.tex drivers/hpplot.c
  24. #   include/declare.h src/define.c src/plbox3.c src/plmtex.c
  25. #   src/plot3d.c src/plside3.c src/plstar.c src/plstr.c src/plxybx.c
  26. #   unix/tektronix.c
  27. # Wrapped by tadguy@xanth on Sun Jan 14 18:11:34 1990
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'Amiga/plwindow.c' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'Amiga/plwindow.c'\"
  31. else
  32. echo shar: Extracting \"'Amiga/plwindow.c'\" \(3951 characters\)
  33. sed "s/^X//" >'Amiga/plwindow.c' <<'END_OF_FILE'
  34. X#include "plplot.h"
  35. X#include "plamiga.h"
  36. X#include <stdio.h>
  37. X#include <math.h>
  38. X
  39. Xextern struct PLPrefs PLCurPrefs;
  40. X
  41. XPLINT MaxColors;
  42. X
  43. Xextern PLFLT InitWSize, InitHSize;
  44. X
  45. Xstruct Screen *PLScreen;        /* For Custom Screen */
  46. Xstruct Window *PLWindow;
  47. Xstruct RastPort *PLSRPort;      /* Screen rastport */
  48. Xstruct RastPort *PLWRPort;      /* Window rastport */
  49. Xstruct ViewPort *PLVPort;
  50. Xstruct ColorMap *PLCMap;
  51. Xstatic struct TmpRas PLTmpRas;
  52. Xstatic PLANEPTR PLTmpPlane;
  53. X
  54. Xstruct NewWindow NewWindow = {
  55. X   0, 0,
  56. X   0, 0,
  57. X   0, 1,
  58. X   0,
  59. X   0,
  60. X   NULL,
  61. X   NULL,
  62. X   NULL,
  63. X   NULL,                            /* Screen pointer */
  64. X   NULL,
  65. X   205, 120, 1000, 1000,
  66. X   WBENCHSCREEN
  67. X};
  68. X
  69. Xvoid OpenPLWind()
  70. X{
  71. X   short i;
  72. X
  73. X   if(PLCurPrefs.WinType & PLCUST) {
  74. X      struct NewScreen NewScreen = {
  75. X         0, 0, 0, 0, 1,
  76. X         0, 1,
  77. X         HIRES,                        /* default viewmode */
  78. X         CUSTOMSCREEN,
  79. X         NULL,
  80. X         "Plplot Screen",
  81. X         NULL,
  82. X         NULL
  83. X      };
  84. X
  85. X      NewScreen.Height = GfxBase->NormalDisplayRows;
  86. X      NewScreen.Width = GfxBase->NormalDisplayColumns;
  87. X
  88. X      if(PLCurPrefs.ScrType & PLLACE) {
  89. X         NewScreen.ViewModes |= INTERLACE;
  90. X         NewScreen.Height *= 2;
  91. X      }
  92. X      if(!(PLCurPrefs.ScrType & PLHIRES)) {
  93. X         NewScreen.ViewModes &= ~HIRES;
  94. X         NewScreen.Width /= 2;
  95. X      }
  96. X
  97. X      NewScreen.Depth = PLCurPrefs.Depth;
  98. X      NewWindow.Type = CUSTOMSCREEN;
  99. X      if((PLScreen = OpenScreen(&NewScreen)) == NULL) {
  100. X         fprintf(stderr,"Not enough memory for custom screen.\n");
  101. X         CloseLibs();
  102. X         pl_exit();
  103. X      }
  104. X      for(i=0, MaxColors=1; i<PLCurPrefs.Depth; i++)
  105. X         MaxColors *= 2;
  106. X      PLVPort = &(PLScreen->ViewPort);
  107. X      LoadRGB4(PLVPort,&(PLCurPrefs.Color[0]),MaxColors);
  108. X      NewWindow.Screen = PLScreen;
  109. X      if(PLCurPrefs.CWidth == 0 || PLCurPrefs.CHeight == 0) {
  110. X         NewWindow.Width = PLScreen->Width;
  111. X         NewWindow.Height = PLScreen->Height - PLScreen->BarHeight - 1;
  112. X         NewWindow.LeftEdge = 0;
  113. X         NewWindow.TopEdge = PLScreen->BarHeight + 1;
  114. X         PLCurPrefs.CXPos = NewWindow.Width;
  115. X         PLCurPrefs.CYPos = NewWindow.Height;
  116. X         PLCurPrefs.CWidth = NewWindow.Width;
  117. X         PLCurPrefs.CHeight = NewWindow.Height;
  118. X      }
  119. X      else {
  120. X         NewWindow.LeftEdge = PLCurPrefs.CXPos;
  121. X         NewWindow.TopEdge = PLCurPrefs.CYPos;
  122. X         NewWindow.Width = PLCurPrefs.CWidth;
  123. X         NewWindow.Height = PLCurPrefs.CHeight;
  124. X      }
  125. X   }
  126. X   else {
  127. X      MaxColors = 4;
  128. X      NewWindow.LeftEdge = PLCurPrefs.WXPos;
  129. X      NewWindow.TopEdge = PLCurPrefs.WYPos;
  130. X      NewWindow.Width = PLCurPrefs.WWidth;
  131. X      NewWindow.Height = PLCurPrefs.WHeight;
  132. X      NewWindow.Type = WBENCHSCREEN;
  133. X   }
  134. X
  135. X   NewWindow.IDCMPFlags = NEWSIZE|MENUPICK|CLOSEWINDOW;
  136. X   NewWindow.Flags = WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|WINDOWSIZING|
  137. X                     SMART_REFRESH|ACTIVATE;
  138. X   NewWindow.Title = "Plplot 2.0 - Tony Richardson";
  139. X
  140. X   if((PLWindow = OpenWindow(&NewWindow)) == NULL) {
  141. X      fprintf(stderr,"Error opening window.\n");
  142. X      if(PLCurPrefs.WinType & PLCUST)
  143. X         CloseScreen(PLScreen);
  144. X      CloseLibs();
  145. X   }
  146. X
  147. X   if(!(PLCurPrefs.WinType & PLCUST))
  148. X      PLScreen = PLWindow->WScreen;
  149. X
  150. X   PLSRPort = &(PLScreen->RastPort);
  151. X   PLWRPort = PLWindow->RPort;
  152. X   PLVPort = &(PLScreen->ViewPort);
  153. X   PLCMap = PLVPort->ColorMap;
  154. X   PLTmpPlane = AllocRaster(PLScreen->Width,PLScreen->Height);
  155. X   if(PLTmpPlane == NULL) {
  156. X      CloseWindow(PLWindow);
  157. X      if(PLCurPrefs.WinType & PLCUST)
  158. X         CloseScreen(PLScreen);
  159. X      fprintf(stderr,"Out of memory!");
  160. X   }
  161. X   InitTmpRas(&PLTmpRas,PLTmpPlane,RASSIZE(PLScreen->Width,PLScreen->Height));
  162. X   PLWRPort->TmpRas = &PLTmpRas;
  163. X
  164. X   MakePLMenu();
  165. X}
  166. X
  167. Xvoid ClosePLWind()
  168. X{
  169. X   FreeRaster(PLTmpPlane,PLScreen->Width,PLScreen->Height);
  170. X   ClearMenuStrip(PLWindow);
  171. X   CloseWindow(PLWindow);
  172. X   if((PLScreen->Flags & SCREENTYPE) == CUSTOMSCREEN)
  173. X      CloseScreen(PLScreen);
  174. X}
  175. X
  176. END_OF_FILE
  177. if test 3951 -ne `wc -c <'Amiga/plwindow.c'`; then
  178.     echo shar: \"'Amiga/plwindow.c'\" unpacked with wrong size!
  179. fi
  180. # end of 'Amiga/plwindow.c'
  181. fi
  182. if test -f 'docs/chapter1.tex' -a "${1}" != "-c" ; then 
  183.   echo shar: Will not clobber existing file \"'docs/chapter1.tex'\"
  184. else
  185. echo shar: Extracting \"'docs/chapter1.tex'\" \(3931 characters\)
  186. sed "s/^X//" >'docs/chapter1.tex' <<'END_OF_FILE'
  187. X\chapter {Introduction}
  188. X\pagenumbering{arabic}
  189. X\section {The PLPLOT Plotting Library}
  190. X
  191. XPLPLOT is a library of C functions that are useful for making
  192. Xscientific plots.
  193. XThe PLPLOT library can be used to create standard x-y plots, semilog plots,
  194. Xlog-log plots, contour plots, 3D plots, mesh plots, bar charts and pie
  195. Xcharts. Multiple graphs (of the same or different sizes) may be placed
  196. Xon a single page with multiple lines in each graph. Different line
  197. Xstyles, widths and colors are supported. A virtually infinite number
  198. Xof distinct area fill patterns may be used. There are almost 2000 characters
  199. Xin the extended character set. This includes four different fonts,
  200. Xthe Greek alphabet and a host of mathematical, musical, and other symbols.
  201. XThe fonts can be scaled to any size for various effects.
  202. X
  203. XSeveral output devices are supported and new devices can be
  204. Xeasily added by writing a small number of device dependent routines.
  205. XThe C source for PLPLOT was written on an Amiga but has been ported
  206. Xto several other systems.
  207. X
  208. XMany of the underlying concepts used in the PLPLOT subroutine package
  209. Xare based on ideas used in Tim Pearson's PGPLOT package originally
  210. Xwritten in VAX-specific Fortran-77.  Sze Tan of the University of
  211. XAuckland originally developed PLPLOT on an IBM PC, and subsequently
  212. Xtransferred it to a number of other machines. Additional features were
  213. Xadded to allow three-dimensional plotting and better access to low-level
  214. Xroutines. The C version of PLPLOT was born when I decided to translate
  215. Xthe package from Fortran in an attempt to teach myself C. In the
  216. Xprocess several of the routines were rewritten to improve efficiency
  217. Xand several new features were
  218. Xadded that allow mesh plotting and area fills. The program structure
  219. Xwas changed somewhat to make it easier to incorporate
  220. Xnew devices.
  221. X
  222. XThis original version of this manual was written by Sze Tan.
  223. X
  224. X\section {Installing and Using the PLPLOT Library}
  225. XThe installation procedure is by necessity system specific and the
  226. Xinstallation guide should be referred to for details. The procedure
  227. Xrequires that all of the routines be compiled and they are then
  228. Xusually placed in a linkable library.
  229. X
  230. XAfter the library has been created, you can write your main program
  231. Xto make the desired PLPLOT calls.
  232. XSeveral example programs are included in this release to help guide
  233. Xyou in creating the main program (Be sure to include plplot.h in your
  234. Xmain program as in the examples.).
  235. X
  236. XYou will then need to compile your program and link it with the
  237. Xplplot library. On a UNIX system this can be done using something similar
  238. Xto (this is system specific)
  239. X\begin{verbatim}
  240. Xcc -o main main.c -lplplot
  241. X\end{verbatim}
  242. Xwhile on an Amiga (with the Lattice C compiler) you might use something
  243. Xlike (this depends on the compiler options you have used when creating
  244. Xthe library)
  245. X\begin{verbatim}
  246. Xlc -o main -Lm+plplot.lib main.c
  247. X\end{verbatim}
  248. X
  249. XIf you have any problems I suggest you see the local C wizard.
  250. X
  251. X\section {Organization of this Manual}
  252. XBecause the library has been ported to so many different systems, this
  253. Xmanual describes the library in general terms.
  254. XSystem specific installation instructions and descriptions of supported
  255. Xdevices are given in the installation manual.
  256. X
  257. XThe PLPLOT library has been designed so that it is easy to write programs
  258. Xproducing graphical output without having to set up large numbers of
  259. Xparameters. However, more precise control of the results may be necessary,
  260. Xand these are accomodated by providing lower-level routines which change
  261. Xthe system defaults. In chapter \ref{simple}, the overall process of
  262. Xproducing
  263. Xa graph using the high-level routines is described. Chapter \ref{advanced}
  264. Xdiscusses the underlying concepts of the plotting process and introduces
  265. Xsome of the more complex routines. The reference section of the manual,
  266. Xchapter \ref{reference} is an alphabetical list of the user-accessible
  267. XPLPLOT functions with detailed descriptions.
  268. X
  269. END_OF_FILE
  270. if test 3931 -ne `wc -c <'docs/chapter1.tex'`; then
  271.     echo shar: \"'docs/chapter1.tex'\" unpacked with wrong size!
  272. fi
  273. # end of 'docs/chapter1.tex'
  274. fi
  275. if test -f 'drivers/hpplot.c' -a "${1}" != "-c" ; then 
  276.   echo shar: Will not clobber existing file \"'drivers/hpplot.c'\"
  277. else
  278. echo shar: Extracting \"'drivers/hpplot.c'\" \(3614 characters\)
  279. sed "s/^X//" >'drivers/hpplot.c' <<'END_OF_FILE'
  280. X/* This file contains drivers for the HP7475A plotter */
  281. X
  282. X#include "plplot.h"
  283. X#include <stdio.h>
  284. X#include <string.h>
  285. X
  286. X#define PLTX       10299
  287. X#define PLTY        7649
  288. X
  289. Xstatic FILE *OutDev;
  290. Xstatic PLINT orient;
  291. Xstatic PLINT select=0;
  292. Xstatic char FileName[80];
  293. X
  294. Xvoid hp7475setup(xdpi, ydpi, xwid, ywid)
  295. XPLINT xwid, ywid;
  296. XPLFLT xdpi, ydpi;
  297. X{
  298. X}
  299. X
  300. Xvoid hp7475select(ori, name)
  301. XPLINT ori;
  302. Xchar *name;
  303. X{
  304. X   orient = ori;
  305. X   strncpy(FileName,name,sizeof(FileName)-1);
  306. X   FileName[sizeof(FileName)-1] = '\0';
  307. X   select = 1;
  308. X}
  309. X
  310. X/* Set up device specific stuff and initialize the device */
  311. X/* If orient is 0 set up for landscape, otherwise portrait. */
  312. Xvoid hp7475init()
  313. X{
  314. X   char line[80];
  315. X
  316. X   if(!select) {
  317. X      printf("Landscape or portrait orientation? (0 or 1) ");
  318. X      fgets(line,sizeof(line),stdin);
  319. X      if(sscanf(line,"%d",&orient) != 1)
  320. X         orient = 0;
  321. X   }
  322. X
  323. X   /* setpxl() sets the dots/mm in the x and y directions */
  324. X   setpxl(40.,40.);         /* 40 dots/mm or 1016 dots/inch */
  325. X
  326. X   /* setphy() sets the device coordinates. These are integer */
  327. X   /* values. Set up for landscape orientation (long axis of page in the */
  328. X   /* x direction). Origin is in the lower left hand corner. */
  329. X   if(!orient)
  330. X      setphy(0,PLTX,0,PLTY);
  331. X   else
  332. X      setphy(0,PLTY,0,PLTX);
  333. X
  334. X   /* Set default pen color using scol(color). */
  335. X   /* Any default pen color can be used but a black pen is probably best. */
  336. X   scol(1);
  337. X
  338. X   /* Set default pen width using swid(width) */
  339. X   swid(1);
  340. X
  341. X   /* Set device interaction mode using smod(mode). Set mode to 0 for */
  342. X   /* a noninteractive device, Unless you are writing your */
  343. X   /* own Amiga screen driver mode should be 0. */
  344. X   smod(0);
  345. X
  346. X   /* Well that's all the information plplot needs. Let's prompt for a */
  347. X   /* graphics file name. */
  348. X   for(;;) {
  349. X      if(!select) {
  350. X         printf("Enter graphics file name. ");
  351. X         fgets(line,sizeof(line),stdin);
  352. X         if(sscanf(line,"%s",FileName)!=1)
  353. X            continue;
  354. X      }
  355. X
  356. X      if (!(OutDev = fopen(FileName,"w"))) {
  357. X         fprintf(stderr,"Can't open %s.\n",FileName);
  358. X         select = 0;
  359. X      }
  360. X      else
  361. X         break;
  362. X   }
  363. X   select = 0;
  364. X   fprintf(OutDev,"IN; ");
  365. X}
  366. X
  367. X/* Sets to text mode */
  368. Xvoid hp7475text()
  369. X{
  370. X   /* None of the built in fonts are supported yet. */
  371. X}
  372. X
  373. X/* Sets to graphics mode */
  374. Xvoid hp7475graph()
  375. X{
  376. X   /* We're always in graphics mode with this device. */
  377. X}
  378. X
  379. X/* Clears the page */
  380. Xvoid hp7475clear()
  381. X{
  382. X   /* On the HP plotter eject the page. */
  383. X   fprintf(OutDev,"PG; ");
  384. X}
  385. X
  386. Xstatic PLINT xlast, ylast;
  387. X
  388. Xvoid hp7475page()
  389. X{
  390. X   xlast = -100000; ylast = -100000;
  391. X}
  392. X
  393. Xvoid hp7475width(width)
  394. XPLINT width;
  395. X{
  396. X}
  397. X
  398. X/* Change the pen color */
  399. Xvoid hp7475color(color)
  400. XPLINT color;
  401. X{
  402. X   if(color<1 || color>8)
  403. X      fprintf(stderr,"Invalid pen selection.\n");
  404. X   else
  405. X      fprintf(OutDev,"SP %d;",color);
  406. X}
  407. X
  408. X
  409. X/* Draws a line from (x1,y1) to (x2,y2) */
  410. Xvoid hp7475line(x1,y1,x2,y2)
  411. XPLINT x1,y1,x2,y2;
  412. X{
  413. X
  414. X   /* If starting point of this line is the same as the ending point of */
  415. X   /* the previous line then don't raise the pen. (This really speeds up */
  416. X   /* plotting and reduces the size of the file. */
  417. X   if(!orient) {
  418. X      if(x1 == xlast && y1 == ylast)
  419. X         fprintf(OutDev," %d %d",x2,y2);
  420. X      else
  421. X         fprintf(OutDev,"\nPU %d %d PD %d %d",x1,y1,x2,y2);
  422. X   }
  423. X   else {
  424. X      if(x1 == xlast && y1 == ylast)
  425. X         fprintf(OutDev," %d %d",PLTX-y2,x2);
  426. X      else
  427. X         fprintf(OutDev,"\nPU %d %d PD %d %d",PLTX-y1,x1,PLTX-y2,x2);
  428. X   }
  429. X
  430. X   xlast = x2;
  431. X   ylast = y2;
  432. X}
  433. X
  434. X/* Cleanup and close file. */
  435. Xvoid hp7475tidy()
  436. X{
  437. X   fprintf(OutDev,"\nSP0");
  438. X   fclose(OutDev);
  439. X}
  440. X
  441. X
  442. X
  443. END_OF_FILE
  444. if test 3614 -ne `wc -c <'drivers/hpplot.c'`; then
  445.     echo shar: \"'drivers/hpplot.c'\" unpacked with wrong size!
  446. fi
  447. # end of 'drivers/hpplot.c'
  448. fi
  449. if test -f 'include/declare.h' -a "${1}" != "-c" ; then 
  450.   echo shar: Will not clobber existing file \"'include/declare.h'\"
  451. else
  452. echo shar: Extracting \"'include/declare.h'\" \(3664 characters\)
  453. sed "s/^X//" >'include/declare.h' <<'END_OF_FILE'
  454. X/*
  455. X* Global variables for C plotting package
  456. X*
  457. X* device  :  Graphics device number
  458. X* termin  :  Zero for noninteractive device, non-zero for terminal
  459. X* graphx  :  Zero if currently in text mode, non-zero for graphics mode
  460. X* currx   :  Physical x-coordinate of current point
  461. X* curry   :  Physical y-coordinate of current point
  462. X* vpp...  :  Viewport boundaries in physical coordinates
  463. X* spp...  :  Subpage  boundaries in physical coordinates
  464. X* clp...  :  Clip     boundaries in physical coordinates
  465. X* phy...  :  Physical device limits in physical coordinates
  466. X* nsub.   :  Number of subpages on physical device
  467. X* cursub  :  Current subpage
  468. X* um.     :  Number of micrometres in a pixel
  469. X* font    :  Current default font
  470. X* colour  :  Current default colour
  471. X* width   :  Current pen width
  472. X* mark    :  Array of mark lengths in micrometres for broken lines
  473. X* space   :  Array of space lengths in micrometres for broken lines
  474. X* nms     :  Number of elements for current broken line style
  475. X* timecnt :  Timer for broken lines
  476. X* alarm   :  Alarm indicating change of broken line status
  477. X* pendn   :  Flag indicating if pen is up or down
  478. X* curel   :  Current element within broken line
  479. X* inclin  :  Array of inclinations in tenths of degree for fill lines
  480. X* delta   :  Array of spacings in micrometers between fill lines
  481. X* nps     :  Number of distinct line styles for fills
  482. X* level   :  Initialization level
  483. X*
  484. X* spd...  :  Subpage  boundaries in normalized device coordinates
  485. X* vpd...  :  Viewport boundaries in normalized device coordinates
  486. X* vpw...  :  Viewport boundaries in world coordinates
  487. X* .pmm    :  Number of pixels to a millimetre
  488. X* wp....  :  Transformation variables for world  to physical conversion
  489. X* dp....  :  Transformation variables for device to physical conversion
  490. X* mp....  :  Transformation variables for millimetres from bottom left
  491. X*             hand corner to physical coordinates
  492. X* wm....  :  Transformation variables for world coordinates to mm
  493. X* chr...  :  Character default height and current (scaled) height
  494. X* sym...  :  Symbol    default height and current (scaled) height
  495. X* maj...  :  Major tick default height and current (scaled) height
  496. X* min...  :  Minor tick default height and current (scaled) height
  497. X* base3.  :  World coordinate size of base for 3-d plot
  498. X* basec.  :  Position of centre of base for 3-d plot
  499. X* dom...  :  Minimum and maximum values for domain
  500. X* zzscl   :  Vertical (z) scale for 3-d plot
  501. X* ran..   :  Minimum and maximum z values for 3-d plot
  502. X* c..     :  Coordinate transformation from 3-d to 2-d
  503. X*/
  504. X
  505. Xextern PLINT device, termin, graphx;
  506. Xextern PLINT currx,  curry;
  507. Xextern PLINT vppxmi, vppxma, vppymi, vppyma;
  508. Xextern PLINT sppxmi, sppxma, sppymi, sppyma;
  509. Xextern PLINT clpxmi, clpxma, clpymi, clpyma;
  510. Xextern PLINT phyxmi, phyxma, phyymi, phyyma;
  511. Xextern PLINT nsubx,  nsuby, cursub;
  512. Xextern PLINT umx,    umy;
  513. Xextern PLINT font,   colour, width, style;
  514. Xextern PLINT mark[], space[], nms, timecnt;
  515. Xextern PLINT alarm,  pendn,  curel;
  516. Xextern PLINT inclin[], delta[], nps;
  517. Xextern PLINT level;
  518. X
  519. Xextern PLFLT spdxmi, spdxma, spdymi, spdyma;
  520. Xextern PLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
  521. Xextern PLFLT vpwxmi, vpwxma, vpwymi, vpwyma;
  522. Xextern PLFLT xpmm,   ypmm;
  523. Xextern PLFLT wpxscl, wpxoff, wpyscl, wpyoff;
  524. Xextern PLFLT dpxscl, dpxoff, dpyscl, dpyoff;
  525. Xextern PLFLT mpxscl, mpxoff, mpyscl, mpyoff;
  526. Xextern PLFLT wmxscl, wmxoff, wmyscl, wmyoff;
  527. Xextern PLFLT chrdef, chrht;
  528. Xextern PLFLT symdef, symht;
  529. Xextern PLFLT majdef, majht;
  530. Xextern PLFLT mindef, minht;
  531. Xextern PLFLT base3x, base3y, basecx, basecy;
  532. Xextern PLFLT domxmi, domxma, domymi, domyma;
  533. Xextern PLFLT zzscl,  ranmi,  ranma;
  534. Xextern PLFLT cxx,    cxy,    cyx,    cyy,   cyz;
  535. END_OF_FILE
  536. if test 3664 -ne `wc -c <'include/declare.h'`; then
  537.     echo shar: \"'include/declare.h'\" unpacked with wrong size!
  538. fi
  539. # end of 'include/declare.h'
  540. fi
  541. if test -f 'src/define.c' -a "${1}" != "-c" ; then 
  542.   echo shar: Will not clobber existing file \"'src/define.c'\"
  543. else
  544. echo shar: Extracting \"'src/define.c'\" \(3491 characters\)
  545. sed "s/^X//" >'src/define.c' <<'END_OF_FILE'
  546. X/*
  547. X* Global variables for C plotting package
  548. X*
  549. X* device  :  Graphics device number
  550. X* termin  :  Zero for noninteractive device, non-zero for terminal
  551. X* graphx  :  Zero if currently in text mode, non-zero for graphics mode
  552. X* currx   :  Physical x-coordinate of current point
  553. X* curry   :  Physical y-coordinate of current point
  554. X* vpp...  :  Viewport boundaries in physical coordinates
  555. X* spp...  :  Subpage  boundaries in physical coordinates
  556. X* clp...  :  Clip     boundaries in physical coordinates
  557. X* phy...  :  Physical device limits in physical coordinates
  558. X* nsub.   :  Number of subpages on physical device
  559. X* cursub  :  Current subpage
  560. X* um.     :  Number of micrometres in a pixel
  561. X* font    :  Current default font
  562. X* colour  :  Current default colour
  563. X* width   :  Current pen width
  564. X* mark    :  Array of mark lengths in micrometres for broken lines
  565. X* space   :  Array of space lengths in micrometres for broken lines
  566. X* nms     :  Number of elements for current broken line style
  567. X* timecnt :  Timer for broken lines
  568. X* alarm   :  Alarm indicating change of broken line status
  569. X* pendn   :  Flag indicating if pen is up or down
  570. X* curel   :  Current element within broken line
  571. X* inclin  :  Array of inclinations in tenths of degree for fill lines
  572. X* delta   :  Array of spacings in micrometers between fill lines
  573. X* nps     :  Number of distinct line styles for fills
  574. X* level   :  Initialization level
  575. X*
  576. X* spd...  :  Subpage  boundaries in normalized device coordinates
  577. X* vpd...  :  Viewport boundaries in normalized device coordinates
  578. X* vpw...  :  Viewport boundaries in world coordinates
  579. X* .pmm    :  Number of pixels to a millimetre
  580. X* wp....  :  Transformation variables for world  to physical conversion
  581. X* dp....  :  Transformation variables for device to physical conversion
  582. X* mp....  :  Transformation variables for millimetres from bottom left
  583. X*             hand corner to physical coordinates
  584. X* wm....  :  Transformation variables for world coordinates to mm
  585. X* chr...  :  Character default height and current (scaled) height
  586. X* sym...  :  Symbol    default height and current (scaled) height
  587. X* maj...  :  Major tick default height and current (scaled) height
  588. X* min...  :  Minor tick default height and current (scaled) height
  589. X* base3.  :  World coordinate size of base for 3-d plot
  590. X* basec.  :  Position of centre of base for 3-d plot
  591. X* dom...  :  Minimum and maximum values for domain
  592. X* zzscl   :  Vertical (z) scale for 3-d plot
  593. X* ran..   :  Minimum and maximum z values for 3-d plot
  594. X* c..     :  Coordinate transformation from 3-d to 2-d
  595. X*/
  596. X
  597. X#include "plplot.h"
  598. X
  599. XPLINT device, termin, graphx;
  600. XPLINT currx,  curry;
  601. XPLINT vppxmi, vppxma, vppymi, vppyma;
  602. XPLINT sppxmi, sppxma, sppymi, sppyma;
  603. XPLINT clpxmi, clpxma, clpymi, clpyma;
  604. XPLINT phyxmi, phyxma, phyymi, phyyma;
  605. XPLINT nsubx,  nsuby, cursub;
  606. XPLINT umx,    umy;
  607. XPLINT font,   colour, width, style;
  608. XPLINT mark[10], space[10], nms, timecnt;
  609. XPLINT alarm,  pendn,  curel;
  610. XPLINT inclin[2], delta[2], nps;
  611. XPLINT level=0;
  612. X
  613. XPLFLT spdxmi, spdxma, spdymi, spdyma;
  614. XPLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
  615. XPLFLT vpwxmi, vpwxma, vpwymi, vpwyma;
  616. XPLFLT xpmm,   ypmm;
  617. XPLFLT wpxscl, wpxoff, wpyscl, wpyoff;
  618. XPLFLT dpxscl, dpxoff, dpyscl, dpyoff;
  619. XPLFLT mpxscl, mpxoff, mpyscl, mpyoff;
  620. XPLFLT wmxscl, wmxoff, wmyscl, wmyoff;
  621. XPLFLT chrdef, chrht;
  622. XPLFLT symdef, symht;
  623. XPLFLT majdef, majht;
  624. XPLFLT mindef, minht;
  625. XPLFLT base3x, base3y, basecx, basecy;
  626. XPLFLT domxmi, domxma, domymi, domyma;
  627. XPLFLT zzscl,  ranmi,  ranma;
  628. XPLFLT cxx,    cxy,    cyx,    cyy,   cyz;
  629. X
  630. END_OF_FILE
  631. if test 3491 -ne `wc -c <'src/define.c'`; then
  632.     echo shar: \"'src/define.c'\" unpacked with wrong size!
  633. fi
  634. # end of 'src/define.c'
  635. fi
  636. if test -f 'src/plbox3.c' -a "${1}" != "-c" ; then 
  637.   echo shar: Will not clobber existing file \"'src/plbox3.c'\"
  638. else
  639. echo shar: Extracting \"'src/plbox3.c'\" \(4058 characters\)
  640. sed "s/^X//" >'src/plbox3.c' <<'END_OF_FILE'
  641. X/* Draws axes and axis labels for 3-d plots */
  642. X
  643. X#include "plplot.h"
  644. X
  645. Xextern PLINT zbackflag, zbcolor;
  646. Xextern PLFLT zticksp;
  647. X
  648. Xvoid plbox3(xopt,xlabel,xtick,nsubx,yopt,ylabel,ytick,nsuby,
  649. X            zopt,zlabel,ztick,nsubz)
  650. Xchar *xopt, *xlabel, *yopt, *ylabel, *zopt, *zlabel;
  651. XPLINT nsubx, nsuby, nsubz;
  652. XPLFLT xtick, ytick, ztick;
  653. X{
  654. X      PLFLT dx,dy,tx,ty,ux,uy;
  655. X      PLFLT xmin,xmax,ymin,ymax,zmin,zmax,zscale;
  656. X      PLFLT cxx,cxy,cyx,cyy,cyz;
  657. X      PLINT ln, level, font;
  658. X
  659. X      glev(&level);
  660. X      if (level < 3) plexit("Please set up window before calling plbox3");
  661. X
  662. X      gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
  663. X      gdom(&xmin,&xmax,&ymin,&ymax);
  664. X      grange(&zscale,&zmin,&zmax);
  665. X
  666. X      /* We have to wait until after the plot is drawn to draw back */
  667. X      /* grid so store this stuff. */
  668. X      zbackflag = stsearch(zopt,'d');
  669. X      if(zbackflag) {
  670. X         /* save tick spacing and color */
  671. X         zticksp = ztick;
  672. X         gatt(&font,&zbcolor);
  673. X      }
  674. X
  675. X      if (cxx >= 0.0 && cxy <= 0.0) {
  676. X        ln= stsearch(xopt,'n');
  677. X        tx=w3wcx(xmin,ymin,zmin);
  678. X        ty=w3wcy(xmin,ymin,zmin);
  679. X        ux=w3wcx(xmax,ymin,zmin);
  680. X        uy=w3wcy(xmax,ymin,zmin);
  681. X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmin,xmax,xtick,nsubx,0);
  682. X        dx = ux - tx;
  683. X        dy = uy - ty;
  684. X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
  685. X             w3wcy(xmax,ymin,zmax),zmin,zmax,ztick,nsubz);
  686. X        tx=w3wcx(xmin,ymax,zmin);
  687. X        ty=w3wcy(xmin,ymax,zmin);
  688. X        ux=w3wcx(xmin,ymin,zmin);
  689. X        uy=w3wcy(xmin,ymin,zmin);
  690. X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymax,ymin,ytick,nsuby,ln);
  691. X        dx = ux - tx;
  692. X        dy = uy - ty;
  693. X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
  694. X             w3wcy(xmin,ymax,zmax),zmin,zmax,ztick,nsubz);
  695. X
  696. X      }
  697. X      else if (cxx <= 0.0 && cxy <= 0.0) {
  698. X        ln=stsearch(yopt,'n');
  699. X        tx=w3wcx(xmin,ymax,zmin);
  700. X        ty=w3wcy(xmin,ymax,zmin);
  701. X        ux=w3wcx(xmin,ymin,zmin);
  702. X        uy=w3wcy(xmin,ymin,zmin);
  703. X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymax,ymin,ytick,nsuby,0);
  704. X        dx = ux - tx;
  705. X        dy = uy - ty;
  706. X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
  707. X             w3wcy(xmin,ymin,zmax),zmin,zmax,ztick,nsubz);
  708. X        tx=w3wcx(xmax,ymax,zmin);
  709. X        ty=w3wcy(xmax,ymax,zmin);
  710. X        ux=w3wcx(xmin,ymax,zmin);
  711. X        uy=w3wcy(xmin,ymax,zmin);
  712. X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmax,xmin,xtick,nsubx,ln);
  713. X        dx = ux - tx;
  714. X        dy = uy - ty;
  715. X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
  716. X             w3wcy(xmax,ymax,zmax),zmin,zmax,ztick,nsubz);
  717. X
  718. X      }
  719. X      else if (cxx <= 0.0 && cxy >= 0.0) {
  720. X        ln= stsearch(xopt,'n');
  721. X        tx=w3wcx(xmax,ymax,zmin);
  722. X        ty=w3wcy(xmax,ymax,zmin);
  723. X        ux=w3wcx(xmin,ymax,zmin);
  724. X        uy=w3wcy(xmin,ymax,zmin);
  725. X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmax,xmin,xtick,nsubx,0);
  726. X        dx = ux - tx;
  727. X        dy = uy - ty;
  728. X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
  729. X             w3wcy(xmin,ymax,zmax),zmin,zmax,ztick,nsubz);
  730. X        tx=w3wcx(xmax,ymin,zmin);
  731. X        ty=w3wcy(xmax,ymin,zmin);
  732. X        ux=w3wcx(xmax,ymax,zmin);
  733. X        uy=w3wcy(xmax,ymax,zmin);
  734. X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymin,ymax,ytick,nsuby,ln);
  735. X        dx = ux - tx;
  736. X        dy = uy - ty;
  737. X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
  738. X             w3wcy(xmax,ymin,zmax),zmin,zmax,ztick,nsubz);
  739. X      }
  740. X      else if (cxx >= 0.0 && cxy >= 0.0) {
  741. X        ln= stsearch(yopt,'n');
  742. X        tx=w3wcx(xmax,ymin,zmin);
  743. X        ty=w3wcy(xmax,ymin,zmin);
  744. X        ux=w3wcx(xmax,ymax,zmin);
  745. X        uy=w3wcy(xmax,ymax,zmin);
  746. X        plxybx(yopt,ylabel,tx,ty,ux,uy,ymin,ymax,ytick,nsuby,0);
  747. X        dx = ux - tx;
  748. X        dy = uy - ty;
  749. X        plzbx(zopt,zlabel,1,dx,dy,ux,uy,
  750. X             w3wcy(xmax,ymax,zmax),zmin,zmax,ztick,nsubz);
  751. X        tx=w3wcx(xmin,ymin,zmin);
  752. X        ty=w3wcy(xmin,ymin,zmin);
  753. X        ux=w3wcx(xmax,ymin,zmin);
  754. X        uy=w3wcy(xmax,ymin,zmin);
  755. X        plxybx(xopt,xlabel,tx,ty,ux,uy,xmin,xmax,xtick,nsubx,ln);
  756. X        dx = ux - tx;
  757. X        dy = uy - ty;
  758. X        plzbx(zopt,zlabel,0,dx,dy,tx,ty,
  759. X             w3wcy(xmin,ymin,zmax),zmin,zmax,ztick,nsubz);
  760. X
  761. X      }
  762. X}
  763. X
  764. END_OF_FILE
  765. if test 4058 -ne `wc -c <'src/plbox3.c'`; then
  766.     echo shar: \"'src/plbox3.c'\" unpacked with wrong size!
  767. fi
  768. # end of 'src/plbox3.c'
  769. fi
  770. if test -f 'src/plmtex.c' -a "${1}" != "-c" ; then 
  771.   echo shar: Will not clobber existing file \"'src/plmtex.c'\"
  772. else
  773. echo shar: Extracting \"'src/plmtex.c'\" \(3972 characters\)
  774. sed "s/^X//" >'src/plmtex.c' <<'END_OF_FILE'
  775. X/* Prints out "text" at specified position relative to viewport       */
  776. X/* (may be inside or outside)                                         */
  777. X
  778. X/* side   String which is one of the following:                       */
  779. X/*        B or b  :  Bottom of viewport                               */
  780. X/*        T or t  :  Top of viewport                                  */
  781. X/*        L or l  :  Left of viewport                                 */
  782. X/*        R or r  :  Right of viewport                                */
  783. X/*        LV or lv : Left of viewport, vertical text                  */
  784. X/*        RV or rv : Right of viewport, vertical text                 */
  785. X/* disp   Displacement from specified edge of viewport, measured      */
  786. X/*         outwards from the viewport in units of the current         */
  787. X/*         character height. The CENTRELINES of the characters are    */
  788. X/*         aligned with the specified position.                       */
  789. X/* pos    Position of the reference point of the string relative      */
  790. X/*         to the viewport edge, ranging from 0.0 (left-hand edge)    */
  791. X/*         to 1.0 (right-hand edge)                                   */
  792. X/* just   Justification of string relative to reference point         */
  793. X/*         just = 0.0 => left hand edge of string is at reference     */
  794. X/*         just = 1.0 => right hand edge of string is at reference    */
  795. X/*         just = 0.5 => centre of string is at reference             */
  796. X
  797. X#include "plplot.h"
  798. X
  799. Xvoid plmtex(side,disp,pos,just,text)
  800. Xchar *side, *text;
  801. XPLFLT disp, pos, just;
  802. X{
  803. X      PLINT clpxmi, clpxma, clpymi, clpyma;
  804. X      PLINT sppxmi, sppxma, sppymi, sppyma;
  805. X      PLINT vert, refx, refy;
  806. X      PLFLT shift, xform[4];
  807. X      PLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
  808. X      PLFLT chrdef, chrht;
  809. X      PLFLT mpxscl, mpxoff, mpyscl, mpyoff;
  810. X      PLINT level;
  811. X
  812. X      glev(&level);
  813. X      if (level < 2) plexit("Please set up viewport before calling plmtex.");
  814. X
  815. X      /* Open clip limits to subpage limits */
  816. X
  817. X      gclp(&clpxmi,&clpxma,&clpymi,&clpyma);
  818. X      gspp(&sppxmi,&sppxma,&sppymi,&sppyma);
  819. X      sclp(sppxmi,sppxma,sppymi,sppyma);
  820. X
  821. X      gvpd(&vpdxmi,&vpdxma,&vpdymi,&vpdyma);
  822. X      gmp(&mpxscl,&mpxoff,&mpyscl,&mpyoff);
  823. X      gchr(&chrdef,&chrht);
  824. X
  825. X      shift = 0.0;
  826. X      if (just!=0.0) shift = just * plstrl(text);
  827. X
  828. X      if (stsearch(side,'b')) {
  829. X        vert = 0;
  830. X        refx = dcpcx((PLFLT)(vpdxmi + (vpdxma-vpdxmi) * pos)) - shift*mpxscl;
  831. X        refy = mmpcy((PLFLT)(dcmmy(vpdymi) - disp * chrht));
  832. X      }
  833. X      else if (stsearch(side,'t')) {
  834. X        vert = 0;
  835. X        refx = dcpcx((PLFLT)(vpdxmi + (vpdxma-vpdxmi) * pos)) - shift*mpxscl;
  836. X        refy = mmpcy((PLFLT)(dcmmy(vpdyma) + disp * chrht));
  837. X      }
  838. X      else if (stindex(side,"LV")!=-1 || stindex(side,"lv")!=-1) {
  839. X        vert = 0;
  840. X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos));
  841. X        refx = mmpcx((PLFLT)(dcmmx(vpdxmi) - disp * chrht - shift));
  842. X      }
  843. X      else if (stindex(side,"RV")!=-1 || stindex(side,"rv")!=-1) {
  844. X        vert = 0;
  845. X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos));
  846. X        refx = mmpcx((PLFLT)(dcmmx(vpdxma) + disp * chrht - shift));
  847. X      }
  848. X      else if (stsearch(side,'l')) {
  849. X        vert = 1;
  850. X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos)) - shift*mpyscl;
  851. X        refx = mmpcx((PLFLT)(dcmmx(vpdxmi) - disp * chrht));
  852. X      }
  853. X      else if (stsearch(side,'r')) {
  854. X        vert = 1;
  855. X        refy = dcpcy((PLFLT)(vpdymi + (vpdyma-vpdymi) * pos)) - shift*mpyscl;
  856. X        refx = mmpcx((PLFLT)(dcmmx(vpdxma) + disp * chrht));
  857. X      }
  858. X      else {
  859. X        sclp(clpxmi,clpxma,clpymi,clpyma);
  860. X        return;
  861. X      }
  862. X
  863. X      if (vert != 0) {
  864. X        xform[0] = 0.0;
  865. X        xform[1] = -1.0;
  866. X        xform[2] = 1.0;
  867. X        xform[3] = 0.0;
  868. X      }
  869. X      else {
  870. X        xform[0] = 1.0;
  871. X        xform[1] = 0.0;
  872. X        xform[2] = 0.0;
  873. X        xform[3] = 1.0;
  874. X      }
  875. X      plstr(0,xform,refx,refy,text);
  876. X      sclp(clpxmi,clpxma,clpymi,clpyma);
  877. X}
  878. END_OF_FILE
  879. if test 3972 -ne `wc -c <'src/plmtex.c'`; then
  880.     echo shar: \"'src/plmtex.c'\" unpacked with wrong size!
  881. fi
  882. # end of 'src/plmtex.c'
  883. fi
  884. if test -f 'src/plot3d.c' -a "${1}" != "-c" ; then 
  885.   echo shar: Will not clobber existing file \"'src/plot3d.c'\"
  886. else
  887. echo shar: Extracting \"'src/plot3d.c'\" \(4067 characters\)
  888. sed "s/^X//" >'src/plot3d.c' <<'END_OF_FILE'
  889. X/* Plots a 3-d representation of the function z[x][y]. The x values */
  890. X/* are stored as x[0..nx-1], the y values as y[0..ny-1], and the */
  891. X/* z values are in the 2-d array z[][0..ly-1]. The integer "opt" */
  892. X/* specifies: */
  893. X/*  opt = 1:  Draw lines parallel to x-axis */
  894. X/*  opt = 2:  Draw lines parallel to y-axis */
  895. X/*  opt = 3:  Draw lines parallel to both axes */
  896. X
  897. X#include "plplot.h"
  898. X#include <math.h>
  899. X
  900. X#ifdef PLSTDC
  901. X#include <stdlib.h>
  902. X#else
  903. Xextern char *malloc();
  904. Xextern void free();
  905. X#endif
  906. X
  907. Xextern PLINT *oldhiview;
  908. XPLINT zbackflag=0, zbcolor;
  909. XPLFLT zticksp;
  910. X
  911. Xvoid plot3d(x,y,z,ly,nx,ny,opt,side)
  912. XPLINT ly, nx, ny, opt, side;
  913. XPLFLT *x, *y, *z;
  914. X{
  915. X      PLINT b, color, font;
  916. X      PLFLT cxx, cxy, cyx, cyy, cyz;
  917. X      PLINT init;
  918. X      PLINT *work;
  919. X      PLINT i, ix, iy;
  920. X      PLINT level;
  921. X
  922. X      glev(&level);
  923. X      if (level < 3) plexit("Please set up window before calling plot3d");
  924. X
  925. X      if (opt<1 || opt>3) plexit("Bad option in plot3d");
  926. X      if (nx<=0 || ny<=0 || ly<ny) plexit("Bad array dimensions in plot3d.");
  927. X
  928. X      /* Check that points in x and in y are strictly increasing */
  929. X
  930. X      for (i=0; i<nx-1; i++)
  931. X        if (x[i]>=x[i+1]) plexit("X array must be strictly increasing in plot3d");
  932. X
  933. X      for (i=0; i<ny-1; i++)
  934. X        if (y[i]>=y[i+1]) plexit("Y array must be strictly increasing in plot3d");
  935. X
  936. X      work = (PLINT *)malloc(4*max(nx,ny)*sizeof(PLINT));
  937. X      if(!work)
  938. X         plexit("Out of memory in plot3d.");
  939. X      b = 2*max(nx,ny)+1;
  940. X      gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
  941. X      init = 1;
  942. X
  943. X      if (cxx >= 0.0 && cxy <= 0.0) {
  944. X        if (opt != 2) {
  945. X          for (iy=2; iy<=ny; iy++)  {
  946. X            plt3zz(1,iy,1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  947. X            init = 0;
  948. X          }
  949. X        }
  950. X        else  {
  951. X          plt3zz(1,ny,1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  952. X          init = 0;
  953. X        }
  954. X        if (opt != 1)
  955. X          for (ix=1; ix<=nx-1; ix++)
  956. X            plt3zz(ix,ny,1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  957. X        else
  958. X          plt3zz(1,ny,1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  959. X      }
  960. X      else if (cxx <= 0.0 && cxy <= 0.0) {
  961. X        if (opt != 1) {
  962. X          for (ix=2; ix<=nx; ix++) {
  963. X            plt3zz(ix,ny,-1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  964. X            init = 0;
  965. X          }
  966. X        }
  967. X        else  {
  968. X          plt3zz(nx,ny,-1,-1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  969. X          init = 0;
  970. X        }
  971. X        if (opt != 2)
  972. X          for (iy=ny; iy>=2; iy--)
  973. X            plt3zz(nx,iy,-1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  974. X        else
  975. X          plt3zz(nx,ny,-1,-1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  976. X      }
  977. X      else if (cxx <= 0.0 && cxy >= 0.0) {
  978. X        if (opt != 2) {
  979. X          for (iy=ny-1; iy>=1; iy--) {
  980. X            plt3zz(nx,iy,-1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  981. X            init = 0;
  982. X          }
  983. X        }
  984. X        else {
  985. X          plt3zz(nx,1,-1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  986. X          init = 0;
  987. X        }
  988. X        if (opt != 1)
  989. X          for (ix=nx; ix>=2; ix--)
  990. X            plt3zz(ix,1,-1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  991. X        else
  992. X          plt3zz(nx,1,-1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  993. X      }
  994. X      else if (cxx >= 0.0 && cxy >= 0.0) {
  995. X        if (opt != 1) {
  996. X          for (ix=nx-1; ix>=1; ix--) {
  997. X            plt3zz(ix,1,1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  998. X            init = 0;
  999. X          }
  1000. X        }
  1001. X        else  {
  1002. X          plt3zz(1,1,1,1,opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  1003. X          init = 0;
  1004. X        }
  1005. X        if (opt != 2)
  1006. X          for (iy=1; iy<=ny-1; iy++)
  1007. X            plt3zz(1,iy,1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  1008. X        else
  1009. X          plt3zz(1,1,1,1,-opt,init,x,y,z,ly,nx,ny,&work[0],&work[b-1]);
  1010. X      }
  1011. X
  1012. X      free((VOID *)work);
  1013. X
  1014. X      if(side)
  1015. X         plside3a(x,y,z,ly,nx,ny,opt);
  1016. X
  1017. X      if(zbackflag) {
  1018. X         gatt(&font,&color);
  1019. X         plcol(zbcolor);
  1020. X         plgrid3a(zticksp);
  1021. X         plcol(color);
  1022. X      }
  1023. X
  1024. X      free((VOID *)oldhiview);
  1025. X}
  1026. END_OF_FILE
  1027. if test 4067 -ne `wc -c <'src/plot3d.c'`; then
  1028.     echo shar: \"'src/plot3d.c'\" unpacked with wrong size!
  1029. fi
  1030. # end of 'src/plot3d.c'
  1031. fi
  1032. if test -f 'src/plside3.c' -a "${1}" != "-c" ; then 
  1033.   echo shar: Will not clobber existing file \"'src/plside3.c'\"
  1034. else
  1035. echo shar: Extracting \"'src/plside3.c'\" \(3295 characters\)
  1036. sed "s/^X//" >'src/plside3.c' <<'END_OF_FILE'
  1037. X/* This routine draws sides around the front of the 3d plot so that */
  1038. X/* it does not appear to float */
  1039. X
  1040. X#include "plplot.h"
  1041. X
  1042. Xvoid plside3a(x,y,z,ly,nx,ny,opt)
  1043. XPLINT nx, ny, ly, opt;
  1044. XPLFLT *x, *y, *z;
  1045. X{
  1046. X    PLINT i;
  1047. X    PLFLT cxx, cxy, cyx, cyy, cyz;
  1048. X    PLFLT xmin, ymin, zmin, xmax, ymax, zmax, zscale;
  1049. X    PLFLT tx, ty, ux, uy;
  1050. X
  1051. X    gw3wc(&cxx,&cxy,&cyx,&cyy,&cyz);
  1052. X    gdom(&xmin,&xmax,&ymin,&ymax);
  1053. X    grange(&zscale,&zmin,&zmax);
  1054. X
  1055. X    if (cxx >= 0.0 && cxy <= 0.0)  {
  1056. X        /* Get x, y coordinates of legs and plot */
  1057. X        if (opt != 1) {
  1058. X            for (i=0; i<nx; i++)  {
  1059. X                tx = w3wcx(*(x+i),*y,zmin);
  1060. X                ty = w3wcy(*(x+i),*y,zmin);
  1061. X                ux = w3wcx(*(x+i),*y,*(z+i*ly));
  1062. X                uy = w3wcy(*(x+i),*y,*(z+i*ly));
  1063. X                pljoin(tx,ty,ux,uy);
  1064. X            }
  1065. X        }
  1066. X
  1067. X        if (opt != 2) {
  1068. X            for (i=0; i<ny; i++)  {
  1069. X                tx = w3wcx(*x,*(y+i),zmin);
  1070. X                ty = w3wcy(*x,*(y+i),zmin);
  1071. X                ux = w3wcx(*x,*(y+i),*(z+i));
  1072. X                uy = w3wcy(*x,*(y+i),*(z+i));
  1073. X                pljoin(tx,ty,ux,uy);
  1074. X            }
  1075. X        }
  1076. X    }
  1077. X    else if(cxx <= 0.0  && cxy <= 0.0)  {
  1078. X        if (opt != 1 )  {
  1079. X            for (i=0; i<nx; i++)  {
  1080. X                tx = w3wcx(*(x+i),*(y+ny-1),zmin);
  1081. X                ty = w3wcy(*(x+i),*(y+ny-1),zmin);
  1082. X                ux = w3wcx(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
  1083. X                uy = w3wcy(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
  1084. X                pljoin(tx,ty,ux,uy);
  1085. X            }
  1086. X        }
  1087. X
  1088. X        if (opt != 2)  {
  1089. X            for (i=0; i<ny; i++)  {
  1090. X                tx = w3wcx(*x,*(y+i),zmin);
  1091. X                ty = w3wcy(*x,*(y+i),zmin);
  1092. X                ux = w3wcx(*x,*(y+i),*(z+i));
  1093. X                uy = w3wcy(*x,*(y+i),*(z+i));
  1094. X                pljoin(tx,ty,ux,uy);
  1095. X            }
  1096. X        }
  1097. X    }
  1098. X    else if(cxx <= 0.0  && cxy >= 0.0)  {
  1099. X        if (opt != 1)  {
  1100. X            for (i=0; i<nx; i++)  {
  1101. X                tx = w3wcx(*(x+i),*(y+ny-1),zmin);
  1102. X                ty = w3wcy(*(x+i),*(y+ny-1),zmin);
  1103. X                ux = w3wcx(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
  1104. X                uy = w3wcy(*(x+i),*(y+ny-1),*(z+i*ly+ny-1));
  1105. X                pljoin(tx,ty,ux,uy);
  1106. X            }
  1107. X        }
  1108. X
  1109. X        if (opt != 2)  {
  1110. X            for (i=0; i<ny; i++)  {
  1111. X                tx = w3wcx(*(x+nx-1),*(y+i),zmin);
  1112. X                ty = w3wcy(*(x+nx-1),*(y+i),zmin);
  1113. X                ux = w3wcx(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
  1114. X                uy = w3wcy(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
  1115. X                pljoin(tx,ty,ux,uy);
  1116. X            }
  1117. X        }
  1118. X    }
  1119. X    else if(cxx >= 0.0  && cxy >= 0.0)  {
  1120. X        if (opt != 1)  {
  1121. X            for (i=0; i<nx; i++)  {
  1122. X                tx = w3wcx(*(x+i),*y,zmin);
  1123. X                ty = w3wcy(*(x+i),*y,zmin);
  1124. X                ux = w3wcx(*(x+i),*y,*(z+i*ly));
  1125. X                uy = w3wcy(*(x+i),*y,*(z+i*ly));
  1126. X                pljoin(tx,ty,ux,uy);
  1127. X            }
  1128. X        }
  1129. X
  1130. X        if (opt != 2)  {
  1131. X            for (i=0; i<ny; i++)  {
  1132. X                tx = w3wcx(*(x+nx-1),*(y+i),zmin);
  1133. X                ty = w3wcy(*(x+nx-1),*(y+i),zmin);
  1134. X                ux = w3wcx(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
  1135. X                uy = w3wcy(*(x+nx-1),*(y+i),*(z+(nx-1)*ly+i));
  1136. X                pljoin(tx,ty,ux,uy);
  1137. X            }
  1138. X        }
  1139. X    }
  1140. X}
  1141. END_OF_FILE
  1142. if test 3295 -ne `wc -c <'src/plside3.c'`; then
  1143.     echo shar: \"'src/plside3.c'\" unpacked with wrong size!
  1144. fi
  1145. # end of 'src/plside3.c'
  1146. fi
  1147. if test -f 'src/plstar.c' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'src/plstar.c'\"
  1149. else
  1150. echo shar: Extracting \"'src/plstar.c'\" \(3806 characters\)
  1151. sed "s/^X//" >'src/plstar.c' <<'END_OF_FILE'
  1152. X#include "plplot.h"
  1153. X#include "declare.h"
  1154. X#include "dispatch.h"
  1155. X#include <stdio.h>
  1156. X
  1157. X/* Asks for number of plotting device, and call plbeg to divide the */
  1158. X/* page into nx by ny subpages */
  1159. Xvoid plstar(nx,ny)
  1160. XPLINT nx, ny;
  1161. X{
  1162. X   PLINT dev, i;
  1163. X   char response[10];
  1164. X   extern PLINT npldrivers;
  1165. X   extern DISPATCH_TABLE  plDispatchTable[];
  1166. X
  1167. X   if(level != 0)
  1168. X      plend();
  1169. X
  1170. X   dev = 0;
  1171. X   while(dev<1 || dev>npldrivers) {
  1172. X      printf("\nPlotting Options:\n");
  1173. X      for(i=0; i<npldrivers;i++)
  1174. X         printf(" <%2d> %s\n",i+1,plDispatchTable[i].pl_MenuStr);
  1175. X      printf("\nEnter device number: ");
  1176. X      fgets(response,sizeof(response),stdin);
  1177. X      if(sscanf(response,"%d",&dev) != 1) {
  1178. X         printf("Invalid device number.");
  1179. X         dev = 0;
  1180. X      }
  1181. X   }
  1182. X   plbeg(dev,nx,ny);
  1183. X}
  1184. X
  1185. Xstatic pagesetup=0, select=0;
  1186. X
  1187. X/* Initializes the graphics device "dev"  */
  1188. Xvoid grbeg(dev)
  1189. XPLINT dev;
  1190. X{
  1191. X   PLINT phyxmi, phyxma, phyymi, phyyma;
  1192. X   PLINT mk=0, sp=0;
  1193. X   PLINT inc=0, del=2000;
  1194. X
  1195. X   /* Set device number, graphics mode and font */
  1196. X   device = dev;
  1197. X   graphx = 0;
  1198. X   font = 1;
  1199. X
  1200. X   /* Start by initializing device */
  1201. X   if(pagesetup) {
  1202. X      grsetup();
  1203. X      pagesetup = 0;
  1204. X   }
  1205. X   if(select) {
  1206. X      grselect();
  1207. X      select = 0;
  1208. X   }
  1209. X   grinit();
  1210. X   grpage();
  1211. X
  1212. X   /* Set default sizes */
  1213. X   plschr((PLFLT)4.0,(PLFLT)1.0);
  1214. X   plssym((PLFLT)4.0,(PLFLT)1.0);
  1215. X   plsmaj((PLFLT)3.0,(PLFLT)1.0);
  1216. X   plsmin((PLFLT)1.5,(PLFLT)1.0);
  1217. X
  1218. X   /* Switch to graphics mode and set color */
  1219. X   grgra();
  1220. X   grcol();
  1221. X   grwid();
  1222. X
  1223. X   /* Load standard font */
  1224. X   plfontld(0);
  1225. X   plprec(0,0);
  1226. X   plstyl(0,&mk,&sp);
  1227. X   plpat(1,&inc,&del);
  1228. X
  1229. X   gphy(&phyxmi,&phyxma,&phyymi,&phyyma);
  1230. X   /* Set clip limits. */
  1231. X   sclp(phyxmi,phyxma,phyymi,phyyma);
  1232. X}
  1233. X
  1234. Xstatic PLINT orient, xwidth, ywidth;
  1235. Xstatic PLFLT xdpi, ydpi;
  1236. Xchar FileName[80];
  1237. X
  1238. Xvoid plsetup(xpmm,ypmm,xwid,ywid)
  1239. XPLINT xwid, ywid;
  1240. XPLFLT xpmm, ypmm;
  1241. X{
  1242. X   xdpi = xpmm;
  1243. X   ydpi = ypmm;
  1244. X   xwidth = xwid;
  1245. X   ywidth = ywid;
  1246. X   pagesetup = 1;
  1247. X}
  1248. X
  1249. Xvoid plselect(ori, file)
  1250. XPLINT ori;
  1251. Xchar *file;
  1252. X{
  1253. X   orient = ori;
  1254. X   strncpy(FileName,file,sizeof(FileName)-1);
  1255. X   FileName[sizeof(FileName)-1] = '\0';
  1256. X   select = 1;
  1257. X}
  1258. X
  1259. Xvoid grsetup()
  1260. X{
  1261. X   if(plDispatchTable[device-1].pl_setup)
  1262. X      (*plDispatchTable[device-1].pl_setup)(xdpi,ydpi,xwidth,ywidth);
  1263. X}
  1264. X
  1265. Xvoid grselect()
  1266. X{
  1267. X   if(plDispatchTable[device-1].pl_select)
  1268. X      (*plDispatchTable[device-1].pl_select)(orient, FileName);
  1269. X}
  1270. X
  1271. X/* Initializes the graphics device */
  1272. Xvoid grinit()
  1273. X{
  1274. X   if(plDispatchTable[device-1].pl_init)
  1275. X      (*plDispatchTable[device-1].pl_init)();
  1276. X}
  1277. X
  1278. X/* Clears the graphics screen */
  1279. Xvoid grclr()
  1280. X{
  1281. X   if(plDispatchTable[device-1].pl_clear)
  1282. X      (*plDispatchTable[device-1].pl_clear)();
  1283. X}
  1284. X
  1285. Xvoid grpage()
  1286. X{
  1287. X   if(select) {
  1288. X      grselect();
  1289. X      select = 0;
  1290. X   }
  1291. X   if(plDispatchTable[device-1].pl_page)
  1292. X      (*plDispatchTable[device-1].pl_page)();
  1293. X}
  1294. X
  1295. X/* Sets up the line colour to value in global variable "colour" */
  1296. Xvoid grcol()
  1297. X{
  1298. X   if(plDispatchTable[device-1].pl_color)
  1299. X      (*plDispatchTable[device-1].pl_color)(colour);
  1300. X}
  1301. X
  1302. Xvoid grwid()
  1303. X{
  1304. X   if(plDispatchTable[device-1].pl_width)
  1305. X      (*plDispatchTable[device-1].pl_width)(width);
  1306. X}
  1307. X
  1308. X/* Switches to graphics mode */
  1309. Xvoid grgra()
  1310. X{
  1311. X   if(plDispatchTable[device-1].pl_graph)
  1312. X      (*plDispatchTable[device-1].pl_graph)();
  1313. X
  1314. X   graphx = 1;
  1315. X}
  1316. X
  1317. X/* Draws a line from (x1,x2) to (x2,y2), used by genlin() */
  1318. Xvoid grline(x1,y1,x2,y2)
  1319. XPLINT x1,y1,x2,y2;
  1320. X{
  1321. X   if(plDispatchTable[device-1].pl_line)
  1322. X      (*plDispatchTable[device-1].pl_line)( x1,y1, x2,y2);
  1323. X}
  1324. X
  1325. X/* Switches to text mode */
  1326. Xvoid grtext()
  1327. X{
  1328. X   if(plDispatchTable[device-1].pl_text)
  1329. X      (*plDispatchTable[device-1].pl_text)();
  1330. X
  1331. X   graphx = 0;
  1332. X}
  1333. X
  1334. X/* Called by plend to tidy up graphics device */
  1335. Xvoid grtidy()
  1336. X{
  1337. X   if(plDispatchTable[device-1].pl_tidy)
  1338. X      (*plDispatchTable[device-1].pl_tidy)();
  1339. X}
  1340. X
  1341. END_OF_FILE
  1342. if test 3806 -ne `wc -c <'src/plstar.c'`; then
  1343.     echo shar: \"'src/plstar.c'\" unpacked with wrong size!
  1344. fi
  1345. # end of 'src/plstar.c'
  1346. fi
  1347. if test -f 'src/plstr.c' -a "${1}" != "-c" ; then 
  1348.   echo shar: Will not clobber existing file \"'src/plstr.c'\"
  1349. else
  1350. echo shar: Extracting \"'src/plstr.c'\" \(3667 characters\)
  1351. sed "s/^X//" >'src/plstr.c' <<'END_OF_FILE'
  1352. X/* Prints out a "string" at reference position with physical         */
  1353. X/* coordinates (refx,refy). The coordinates of the vectors defining  */
  1354. X/* the string are passed through the linear mapping defined by the   */
  1355. X/* 2 x 2 matrix xform() before being plotted.                        */
  1356. X/* The reference position is at the left-hand edge of the string. If */
  1357. X/* base = 1, it is aligned with the baseline of the string. If       */
  1358. X/* base = 0, it is aligned with the centre of the character box.     */
  1359. X
  1360. X/* Note, all calculations are done in terms of millimetres. These */
  1361. X/* are scaled as necessary before plotting the string on the page */
  1362. X
  1363. X#include "plplot.h"
  1364. X#include <math.h>
  1365. X
  1366. Xvoid plstr(base,xform,refx,refy,string)
  1367. XPLINT base, refx, refy;
  1368. Xchar *string;
  1369. XPLFLT *xform;
  1370. X{
  1371. X   short int *symbol;
  1372. X   SCHAR *xygrid;
  1373. X   PLINT ch, cx, cy, i, k, length, level, penup;
  1374. X   PLINT xbase, ybase, ydisp, lx, ly, style;
  1375. X   PLINT oline, uline;
  1376. X   PLFLT width, xorg, yorg, x, y, def, ht, dscale, scale;
  1377. X   PLFLT xscl, xoff, yscl, yoff;
  1378. X
  1379. X   width = 0.0;
  1380. X   oline = 0;
  1381. X   uline = 0;
  1382. X
  1383. X   gchr(&def,&ht);
  1384. X   dscale = 0.05*ht;
  1385. X   scale = dscale;
  1386. X   gmp(&xscl,&xoff,&yscl,&yoff);
  1387. X
  1388. X   /* Line style must be continuous */
  1389. X
  1390. X   gnms(&style);
  1391. X   snms(0);
  1392. X
  1393. X   pldeco(&symbol,&length,string);
  1394. X   xorg = 0.0;
  1395. X   yorg = 0.0;
  1396. X   level = 0;
  1397. X
  1398. X   for (i=0; i<length; i++)  {
  1399. X     ch = symbol[i];
  1400. X     if (ch == -1) {
  1401. X       level = level + 1;
  1402. X       yorg = yorg + 16.0 * scale;
  1403. X       scale = dscale * pow(0.75,(double)abs(level));
  1404. X     }
  1405. X     else if (ch == -2) {
  1406. X       level = level - 1;
  1407. X       scale = dscale * pow(0.75,(double)abs(level));
  1408. X       yorg = yorg - 16.0 * scale;
  1409. X     }
  1410. X     else if (ch == -3)
  1411. X       xorg = xorg - width * scale;
  1412. X     else if (ch == -4)
  1413. X       oline = !oline;
  1414. X     else if (ch == -5)
  1415. X       uline = !uline;
  1416. X     else  {
  1417. X       if (plcvec(ch,&xygrid)) {
  1418. X         xbase = xygrid[2];
  1419. X         width = xygrid[3] - xbase;
  1420. X         if (base == 0) {
  1421. X           ybase = 0;
  1422. X           ydisp = xygrid[0];
  1423. X         }
  1424. X         else  {
  1425. X           ybase = xygrid[0];
  1426. X           ydisp = 0;
  1427. X         }
  1428. X         k = 4;
  1429. X         penup = 1;
  1430. X         while(1) {
  1431. X           cx = xygrid[k++];
  1432. X           cy = xygrid[k++];
  1433. X           if(cx == 64 && cy == 64)
  1434. X              break;
  1435. X           if (cx == 64 && cy == 0)
  1436. X             penup = 1;
  1437. X           else {
  1438. X             x = xorg + (cx - xbase) * scale;
  1439. X             y = yorg + (cy - ybase) * scale;
  1440. X             lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
  1441. X             ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
  1442. X             if (penup != 0) {
  1443. X               movphy(lx,ly);
  1444. X               penup = 0;
  1445. X             }
  1446. X             else
  1447. X               draphy(lx,ly);
  1448. X           }
  1449. X         }
  1450. X
  1451. X         if (oline) {
  1452. X           x = xorg;
  1453. X           y = yorg + (30+ydisp)*scale;
  1454. X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
  1455. X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
  1456. X           movphy(lx,ly);
  1457. X           x = xorg + width*scale;
  1458. X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
  1459. X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
  1460. X           draphy(lx,ly);
  1461. X         }
  1462. X         if (uline) {
  1463. X           x = xorg;
  1464. X           y = yorg + (-5+ydisp)*scale;
  1465. X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
  1466. X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
  1467. X           movphy(lx,ly);
  1468. X           x = xorg + width*scale;
  1469. X           lx = refx + round(xscl*(xform[0]*x + xform[1]*y));
  1470. X           ly = refy + round(yscl*(xform[2]*x + xform[3]*y));
  1471. X           draphy(lx,ly);
  1472. X         }
  1473. X         xorg = xorg + width*scale;
  1474. X       }
  1475. X     }
  1476. X   }
  1477. X   snms(style);
  1478. X}
  1479. END_OF_FILE
  1480. if test 3667 -ne `wc -c <'src/plstr.c'`; then
  1481.     echo shar: \"'src/plstr.c'\" unpacked with wrong size!
  1482. fi
  1483. # end of 'src/plstr.c'
  1484. fi
  1485. if test -f 'src/plxybx.c' -a "${1}" != "-c" ; then 
  1486.   echo shar: Will not clobber existing file \"'src/plxybx.c'\"
  1487. else
  1488. echo shar: Extracting \"'src/plxybx.c'\" \(4010 characters\)
  1489. sed "s/^X//" >'src/plxybx.c' <<'END_OF_FILE'
  1490. X/* This draws a sloping line from (wx1,wy1) to (wx2,wy2)             */
  1491. X/*  which represents an axis of a 3-d graph with data values from    */
  1492. X/*  "vmin" to "vmax". Depending on "opt", vertical ticks and/or      */
  1493. X/*  subticks are placed on the line at major tick interval "tick"    */
  1494. X/*  with "nsub" subticks between major ticks. If "tick" and/or       */
  1495. X/*  "nsub" is zero, automatic tick positions are computed            */
  1496. X
  1497. X/* B: Draw box boundary                                              */
  1498. X/* I: Inverts tick marks (i.e. drawn downwards)                      */
  1499. X/* L: Logarithmic axes, major ticks at decades, minor ticks at units */
  1500. X/* N: Write numeric label                                            */
  1501. X/* T: Draw major tick marks                                          */
  1502. X/* S: Draw minor tick marks                                          */
  1503. X/* U: Write label on line                                            */
  1504. X
  1505. X#include "plplot.h"
  1506. X#include <stdio.h>
  1507. X#include <math.h>
  1508. X
  1509. X#define  betw(c,a,b)  ((a <= c && c <= b) || (b <= c && c <= a))
  1510. X
  1511. Xstatic PLFLT xlog[8] =
  1512. X  {0.301030,0.477121,0.602060,0.698970,0.778151,0.845098,0.903090,0.954243};
  1513. X
  1514. Xvoid plxybx(opt,label,wx1,wy1,wx2,wy2,vmin,vmax,tick,nsub,nolast)
  1515. Xchar *opt, *label;
  1516. XPLFLT wx1, wy1, wx2, wy2, vmin, vmax, tick;
  1517. XPLINT nsub, nolast;
  1518. X{
  1519. X      static char string[40];
  1520. X      PLINT lb,li,ll,ln,ls,lt,lu;
  1521. X      PLINT major, minor, mode, prec;
  1522. X      PLINT i, i1, i2, i3, i4;
  1523. X      PLINT nsub1;
  1524. X      PLFLT xpmm, ypmm, defmaj, defmin, htmaj, htmin, tick1;
  1525. X      PLFLT pos, tn, tp, temp;
  1526. X      PLFLT dwx, dwy, lambda;
  1527. X
  1528. X      dwx = wx2 - wx1;
  1529. X      dwy = wy2 - wy1;
  1530. X
  1531. X/* Tick and subtick sizes in device coords */
  1532. X
  1533. X      gpixmm(&xpmm,&ypmm);
  1534. X      gmaj(&defmaj,&htmaj);
  1535. X      gmin(&defmin,&htmin);
  1536. X
  1537. X      major=max(round(htmaj*ypmm),1);
  1538. X      minor=max(round(htmin*ypmm),1);
  1539. X
  1540. X      tick1=tick;
  1541. X      nsub1=nsub;
  1542. X
  1543. X      lb=stsearch(opt,'b');
  1544. X      li=stsearch(opt,'i');
  1545. X      ll=stsearch(opt,'l');
  1546. X      ln=stsearch(opt,'n');
  1547. X      ls=stsearch(opt,'s');
  1548. X      lt=stsearch(opt,'t');
  1549. X      lu=stsearch(opt,'u');
  1550. X
  1551. X      if (lu) plxytx(wx1,wy1,wx2,wy2,(PLFLT)3.2,(PLFLT)0.5,(PLFLT)0.5,label);
  1552. X      if (!lb) return;
  1553. X
  1554. X      if (ll) tick1 = 1.0;
  1555. X      if (lt) pldtik(vmin,vmax,&tick1,&nsub1,&mode,&prec);
  1556. X
  1557. X      if (li) {
  1558. X        i1 = minor;
  1559. X        i2 = 0;
  1560. X        i3 = major;
  1561. X        i4 = 0;
  1562. X      }
  1563. X      else  {
  1564. X        i1 = 0;
  1565. X        i2 = minor;
  1566. X        i3 = 0;
  1567. X        i4 = major;
  1568. X      }
  1569. X
  1570. X/* Draw the line */
  1571. X
  1572. X      movwor(wx1,wy1);
  1573. X      if (lt) {
  1574. X        tp=tick1*floor(vmin/tick1);
  1575. Xlab2:
  1576. X        tn=tp+tick1;
  1577. X        if (ls) {
  1578. X          if (ll) {
  1579. X            for (i=0; i<=7; i++)  {
  1580. X              temp=tp+xlog[i];
  1581. X              if (betw(temp,vmin,vmax)) {
  1582. X                lambda = (temp-vmin)/(vmax-vmin);
  1583. X                plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i1,i2);
  1584. X              }
  1585. X            }
  1586. X          }
  1587. X          else  {
  1588. X            for(i=1; i <= nsub1-1; i++)  {
  1589. X              temp=tp+i*(tn-tp)/nsub1;
  1590. X              if (betw(temp,vmin,vmax)) {
  1591. X                lambda = (temp-vmin)/(vmax-vmin);
  1592. X                plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i1,i2);
  1593. X              }
  1594. X            }
  1595. X          }
  1596. X        }
  1597. X        temp=tn;
  1598. X        if (betw(temp,vmin,vmax)) {
  1599. X          lambda = (temp-vmin)/(vmax-vmin);
  1600. X          plxtik(wcpcx((PLFLT)(wx1+lambda*dwx)),wcpcy((PLFLT)(wy1+lambda*dwy)),i3,i4);
  1601. X          tp=tn;
  1602. X          goto lab2;
  1603. X        }
  1604. X      }
  1605. X
  1606. X      drawor(wx2,wy2);
  1607. X
  1608. X/* Label the line */
  1609. X
  1610. X      if (ln && lt) {
  1611. X        tp=tick1*floor(vmin/tick1);
  1612. Xlab82:
  1613. X        tn=tp+tick1;
  1614. X        if (nolast && !betw(tn+tick1,vmin,vmax)) return;
  1615. X        if (betw(tn,vmin,vmax)) {
  1616. X          if (!ll)
  1617. X            plform(tn,mode,prec,string);
  1618. X          else
  1619. X            sprintf(string,"10#u%-d",round(tn));
  1620. X          pos=(tn-vmin)/(vmax-vmin);
  1621. X          if (ln) plxytx(wx1,wy1,wx2,wy2,(PLFLT)1.5,pos,(PLFLT)0.5,string);
  1622. X          tp=tn;
  1623. X          goto lab82;
  1624. X        }
  1625. X      }
  1626. X}
  1627. END_OF_FILE
  1628. if test 4010 -ne `wc -c <'src/plxybx.c'`; then
  1629.     echo shar: \"'src/plxybx.c'\" unpacked with wrong size!
  1630. fi
  1631. # end of 'src/plxybx.c'
  1632. fi
  1633. if test -f 'unix/tektronix.c' -a "${1}" != "-c" ; then 
  1634.   echo shar: Will not clobber existing file \"'unix/tektronix.c'\"
  1635. else
  1636. echo shar: Extracting \"'unix/tektronix.c'\" \(4130 characters\)
  1637. sed "s/^X//" >'unix/tektronix.c' <<'END_OF_FILE'
  1638. X#include "plplot.h"
  1639. X#include <stdio.h>
  1640. X#include <limits.h>
  1641. X
  1642. X/* This file contains the tektronix dependent routines for use with plplot. */
  1643. X
  1644. X#define TEKX   1023
  1645. X#define TEKY    779
  1646. X
  1647. X/* Define graphics control characters. */
  1648. X#define FF   12
  1649. X#define CAN  24
  1650. X#define ESC  27
  1651. X#define GS   29
  1652. X#define US   31
  1653. X
  1654. Xstatic FILE *OutFile;
  1655. Xstatic int select=0;
  1656. Xstatic int porient;
  1657. Xstatic char FileName[80];
  1658. X
  1659. Xvoid tektsetup(xdpi,ydpi,xwid,ywid)
  1660. XPLFLT xdpi, ydpi;
  1661. XPLINT xwid, ywid;
  1662. X{
  1663. X   /* ignore */
  1664. X}
  1665. X
  1666. Xvoid tekfsetup(xdpi,ydpi,xwid,ywid)
  1667. XPLFLT xdpi, ydpi;
  1668. XPLINT xwid, ywid;
  1669. X{
  1670. X}
  1671. X
  1672. Xvoid tektinit()
  1673. X{
  1674. X      smod(1);   /* an interactive device */
  1675. X      OutFile = stdout;
  1676. X      teksetup(0);
  1677. X}
  1678. X
  1679. Xvoid tekfinit()
  1680. X{
  1681. X      char response[80];
  1682. X      int ori;
  1683. X
  1684. X      smod(0);  /* not an interactive terminal */
  1685. X      if(!select) {
  1686. X         printf("Landscape or portrait orientation? (0 or 1): ");
  1687. X         fgets(response,sizeof(response),stdin);
  1688. X         if(sscanf(response,"%d",&ori) != 1)
  1689. X            ori = 0;   /* carriage return defaults to landscape */
  1690. X      }
  1691. X      
  1692. X      OutFile = NULL;
  1693. X      while(!OutFile) {
  1694. X         if(!select) {
  1695. X            printf("Enter graphics command storage file name. ");
  1696. X            fgets(response,sizeof(response),stdin);
  1697. X            if(sscanf(response,"%s",FileName) != 1)  {
  1698. X                printf("Invalid entry.n");
  1699. X                continue;
  1700. X            }
  1701. X         }
  1702. X         select =0;
  1703. X         if ((OutFile = fopen(FileName,"w")) == NULL) 
  1704. X             printf("Can't open %s.\n",FileName);
  1705. X      }
  1706. X      teksetup(ori);
  1707. X}
  1708. X
  1709. Xteksetup(portrait)
  1710. Xint portrait;
  1711. X{
  1712. X      /* set default pen color*/
  1713. X      scol(1);
  1714. X      porient = portrait;
  1715. X
  1716. X      if(!portrait) {
  1717. X         /* set device resolution in dots/mm */
  1718. X         setpxl(4.771*16,4.653*16);
  1719. X         /* set page size */
  1720. X         setphy(0,TEKX*16,0,TEKY*16);
  1721. X      }
  1722. X      else {
  1723. X         /* set device resolution in dots/mm */
  1724. X         setpxl(4.653*16,4.771*16);
  1725. X         /* set page size */
  1726. X         setphy(0,TEKY*16,0,TEKX*16);
  1727. X      }
  1728. X      fprintf(OutFile,"%c",GS);
  1729. X}
  1730. X
  1731. X/* Sets the tektronix to text mode */
  1732. Xvoid tektext()
  1733. X{
  1734. X    fprintf(OutFile,"%c",US);
  1735. X}
  1736. X
  1737. X/* Sets the tektronix to graphics mode */
  1738. Xvoid tekgraph()
  1739. X{
  1740. X    /* Nothing has to be done here */
  1741. X}
  1742. X
  1743. X/* Clears the tektronix screen */
  1744. Xvoid tektclear()
  1745. X{
  1746. X     putchar('\007');
  1747. X     fflush(stdout);
  1748. X     while(getchar() != '\n')
  1749. X        ;
  1750. X     fprintf(OutFile,"%c%c",ESC,FF);
  1751. X}
  1752. X
  1753. Xvoid tekfclear()
  1754. X{
  1755. X     fprintf(OutFile,"%c%c",ESC,FF);
  1756. X}
  1757. X
  1758. Xvoid tektselect(ori,file)
  1759. XPLINT ori;
  1760. Xchar *file;
  1761. X{
  1762. X}
  1763. X
  1764. Xvoid tekfselect(ori,file)
  1765. XPLINT ori;
  1766. Xchar *file;
  1767. X{
  1768. X   porient = ori;
  1769. X   strncpy(FileName,file,sizeof(FileName)-1);
  1770. X   FileName[sizeof(FileName)-1] = '\0';
  1771. X   select = 1;
  1772. X}
  1773. X
  1774. X/* Change color */
  1775. Xvoid tekcolor(colour)
  1776. XPLINT colour;
  1777. X{
  1778. X}
  1779. X
  1780. Xstatic PLINT xold, yold;
  1781. X
  1782. Xvoid tekpage()
  1783. X{
  1784. X   xold = -100000;
  1785. X   yold = -100000;
  1786. X}
  1787. X
  1788. X
  1789. X/* Change pen width */
  1790. Xvoid tekwidth(width)
  1791. XPLINT width;
  1792. X{
  1793. X}
  1794. X
  1795. X/* Draws a line in the current colour from (x1,y1) to (x2,y2) */
  1796. Xvoid tekline(x1a,y1a,x2a,y2a)
  1797. XPLINT x1a,y1a,x2a,y2a;
  1798. X{
  1799. X    int x1,y1,x2,y2,hy,ly,hx,lx;
  1800. X
  1801. X    x1a >>= 4;
  1802. X    y1a >>= 4;
  1803. X    x2a >>= 4;
  1804. X    y2a >>= 4;
  1805. X
  1806. X    if(!porient) {
  1807. X       x1 = x1a;
  1808. X       y1 = y1a;
  1809. X       x2 = x2a;
  1810. X       y2 = y2a;
  1811. X    }
  1812. X    else {
  1813. X       x1 = TEKX - y1a;
  1814. X       y1 = x1a;
  1815. X       x2 = TEKX - y2a;
  1816. X       y2 = x2a;
  1817. X    }
  1818. X
  1819. X    /* If continuation of previous line just send new point */
  1820. X    if(x1 == xold && y1 == yold) {
  1821. X       hy = y2/32 + 32;
  1822. X       ly = y2 - (y2/32)*32 + 96;
  1823. X       hx = x2/32 + 32;
  1824. X       lx = x2 - (x2/32)*32 + 64;
  1825. X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
  1826. X    }
  1827. X    else {
  1828. X       fprintf(OutFile,"%c",GS);
  1829. X       hy = y1/32 + 32;
  1830. X       ly = y1 - (y1/32)*32 + 96;
  1831. X       hx = x1/32 + 32;
  1832. X       lx = x1 - (x1/32)*32 + 64;
  1833. X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
  1834. X       hy = y2/32 + 32;
  1835. X       ly = y2 - (y2/32)*32 + 96;
  1836. X       hx = x2/32 + 32;
  1837. X       lx = x2 - (x2/32)*32 + 64;
  1838. X       fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
  1839. X    }
  1840. X    xold = x2;
  1841. X    yold = y2;
  1842. X}
  1843. X
  1844. X/* Close file */
  1845. Xvoid tekftidy()
  1846. X{
  1847. X   fclose(OutFile);
  1848. X}
  1849. X
  1850. Xvoid tekttidy()
  1851. X{
  1852. X   tektclear();
  1853. X   fprintf(OutFile,"%c%c",US,CAN);
  1854. X   fflush(OutFile);
  1855. X}
  1856. X
  1857. END_OF_FILE
  1858. if test 4130 -ne `wc -c <'unix/tektronix.c'`; then
  1859.     echo shar: \"'unix/tektronix.c'\" unpacked with wrong size!
  1860. fi
  1861. # end of 'unix/tektronix.c'
  1862. fi
  1863. echo shar: End of archive 4 \(of 12\).
  1864. cp /dev/null ark4isdone
  1865. MISSING=""
  1866. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  1867.     if test ! -f ark${I}isdone ; then
  1868.     MISSING="${MISSING} ${I}"
  1869.     fi
  1870. done
  1871. if test "${MISSING}" = "" ; then
  1872.     echo You have unpacked all 12 archives.
  1873.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1874. else
  1875.     echo You still need to unpack the following archives:
  1876.     echo "        " ${MISSING}
  1877. fi
  1878. ##  End of shell archive.
  1879. exit 0
  1880. -- 
  1881. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  1882.     amiga@cs.odu.edu    
  1883. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  1884. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  1885.  
  1886. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  1887. (only use ``amiga'' for submissions) at the above addresses.
  1888.